package jfoo.playlist;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class PlaylistListCellRenderer implements ListCellRenderer {

	JLabel texte = new JLabel();
	static Color backgroundSelected = new Color(211, 227, 254);
	static Color fontColor1 = new Color(119, 119, 119);

	public PlaylistListCellRenderer() {
		super();
	}

	public Component getListCellRendererComponent(JList list,
			final Object value, int index, boolean isSelected,
			boolean cellHasFocus) {

		texte.setText("   \u2022   " + value.toString());
		texte.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
		texte.setPreferredSize(new Dimension(0, 20));
		texte.setOpaque(true);

		if (isSelected) {
			texte.setForeground(fontColor1);
			texte.setBackground(backgroundSelected);
		} else {
			texte.setForeground(fontColor1);
			texte.setBackground(list.getBackground());
		}

		return texte;

	}

}
